package com.mc.api;

import java.util.Iterator;

public class Queue<Item> implements Iterable<Item>{
	
	private Node head;
	private Node tail;
	private int size=0;;
	
	public void enquene(Item item){
		Node oldTail = tail;
		tail = new Node();
		tail.item = item;
		tail.next = null;
		if(isEmpty())
			head=tail;
		else
			oldTail.next = tail;
		size++;
	}
	public Item dequeue(){
		if(isEmpty())return null;
		Item item = head.item;
		head = head.next;
		if(head==null)
			tail = null;
		size--;
		return item;
	}
	public boolean isEmpty(){
		return size==0;
	}
	public int size(){
		return size;
	}
	
	private class Node{
		Item item;
		Node next;
	}
	@Override
	public Iterator<Item> iterator() {
		// TODO Auto-generated method stub
		return null;
	}
}
